
import request from '@/utils/request'

const api = {
    fileUpload: '/v1/common/file/upload', // 文件上传返回链接
    changeUserPhone: '/v1/user/phone/change', // 修改手机号
    updateUserPassword: '/v1/user/password/update', // 修改密码
    getAgreement: '/v1/agreement/list', // 获取协议信息
    getUserTodo: '/v1/user/my/todo', // 获取用户的待办事项
    getUserResource: '/v1/resource/user/resources', // 获取用户权限信息
}

export function fileUpload (parameter){
    return request({
        url: api.fileUpload,
        method: 'post',
        headers: {
            'name':'fileUpload',
            'file': true,
            'Content-Type': 'multipart/form-data'
        },
        data: parameter,
    })
}

// 修改手机号
export function changeUserPhone (parameter){
    return request({
        url: api.changeUserPhone,
        method: 'post',
        headers: {
            'name':'changeUserPhone',
        },
        data: parameter,
    })
}

// 修改密码
export function updateUserPassword (parameter){
    return request({
        url: api.updateUserPassword,
        method: 'post',
        headers: {
            'name':'updateUserPassword',
        },
        data: parameter,
    })
}

// 获取协议信息
export function getAgreement (){
    return request({
        url: api.getAgreement,
        method: 'get',
        headers: {
            'name':'getAgreement',
        },
        params: {},
    })
}

// 获取待办事项 
export function getUserTodo (){
    return request({
        url: api.getUserTodo,
        method: 'get',
        headers: {
            'name':'getUserTodo',
        },
        params: {},
    })
}

// 获取用户权限信息
export function getUserResource (){
    return request({
        url: api.getUserResource,
        method: 'get',
        headers: {
            'name':'getUserResource',
        },
        params: {},
    })
}